import service from '@/utils/axios'

// 管理员操作金币记录请求参数
export interface AdminAdjustRecordReq {
  operator?: string
  userNo?: string
  pageIndex?: number
  pageSize?: number
}

// 管理员操作金币记录响应数据
export interface CoinTransactionRecordDto {
  id: string
  createUser: string | null
  createTime: string
  modifyUser: string | null
  modifyTime: string
  userId: string
  targetUserId: string | null
  transactionId: string
  transactionType: string
  billType: string
  goodsId: string | null
  goodsCount: number | null
  goodsType: string | null
  amount: number
  balance: number
  balanceBefore: number
  remark: string
  behaviorType: string
  ext: {
    operator: string
    userNo?: string
  }
}

// 管理员操作金币记录响应
export interface AdminAdjustRecordRes {
  hasNextPage: boolean
  list: CoinTransactionRecordDto[]
  nextPage: number
  count: number
  total: number
  size: number
}

// API接口
export const Api = {
  AdminAdjustRecordPage: '/wallet/admin-adjust-record-page',
  AdjustCoin: '/wallet/adjust-coin'
}

// 调整金币请求参数
export interface AdjustCoinReq {
  userNo: string
  coin: number // 对应后端的Integer类型
  remark: string
}

// 获取管理员操作金币记录列表
export function getAdminAdjustRecordPageApi(params: AdminAdjustRecordReq): Promise<any> {
  return service.get(Api.AdminAdjustRecordPage, { params })
}

// 调整金币API
export function adjustCoinApi(data: AdjustCoinReq): Promise<any> {
  return service.post(Api.AdjustCoin, data)
} 